﻿HmJS.$Import('base.element.capslock');
//HmJS.$Import('core.domready');

HmJS.register('demo.module.base.element.capslock', function ($ns) {
	var that = {};

	that.todo = function () {
		var pass = $('passcapsnotice'),
		    user = $('usercapsnotice');

		var passCapsOn = function () {
			pass.setStyle('display', 'block');
		}
		var passCapsOff = function () {
			pass.setStyle('display', 'none');
		}

		var userCapsOn = function () {
			user.setStyle('display', 'block');
		}
		var userCapsOff = function () {
			user.setStyle('display', 'none');
		}

		$('username').addEvents({
			'capsLockOn': userCapsOn,
			'capsLockOff': userCapsOff,
			'blur': userCapsOff,
			'focus': function (event) {
				if (event.hasCapsLock()) { userCapsOn(); }
			}
		});

		$('password').addEvents({
			'capsLockOn': passCapsOn,
			'capsLockOff': passCapsOff,
			'blur': passCapsOff,
			'focus': function (event) {
				if (event.hasCapsLock()) { passCapsOn(); }
			}
		});
	};

	return that;
});
